Method and system for identifying drawing primitives for selective transmission to a remote display

ABSTRACT

Remote desktop servers include a display encoder that maintains a secondary framebuffer that contains display data to be encoded and transmitted to a remote client display and a list of display primitives effectuating updated display data in the secondary framebuffer. The display encoder submits requests to receive the list of drawing primitives to a video adapter driver that receives and tracks drawing primitives that, when executed, update a primary framebuffer.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.12/428,949 filed on Apr. 23, 2009, which issued as U.S. Pat. No.8,902,242, the entirety of which is hereby incorporated by referenceherein.

The present invention is related to U.S. patent application entitled“Method and System for Copying a Framebuffer for Transmission to aRemote Display” Ser. No. 12/428,971 and filed on the same day as thepresent application, which is hereby incorporated by reference.

BACKGROUND

Current operating systems typically include a graphical drawinginterface layer that is accessed by applications in order to renderdrawings on a display, such as a monitor. The graphical drawinginterface layer provides applications an application programminginterface (API) for drawings and converts drawing requests by suchapplications into a set of drawing commands that it then provides to avideo adapter driver. The video adapter driver, in turn, receives thedrawing commands, translates them into video adapter specific drawingprimitives and forwards them to a video adapter (e.g., graphics card,integrated video chipset, etc.). The video adapter receives the drawingprimitives and immediately processes them, or alternatively, stores themin a First In First Out (FIFO) queue for sequential execution, to updatea framebuffer in the video adapter that is used to generate and transmita video signal to a coupled external display. One example of such agraphical drawing interface layer is the Graphical Device Interface(GDI) of the Microsoft® Windows operating system (OS), which isimplemented as a number of user-level and kernel-level dynamicallylinked libraries accessible through the Windows OS.

With the rise of technologies such as server based computing (SBC) andvirtual desktop infrastructure (VDI), organizations are able to replacetraditional personal computers (PCs) with instances of desktops that arehosted on remote desktop servers (or virtual machines running thereon)in a data center. A thin client application installed on a user'sterminal connects to a remote desktop server that transmits a graphicaluser interface of an operating system session for rendering on thedisplay of the user's terminal One example of such a remote desktopserver system is Virtual Network Computing (VNC) which utilizes theRemote Framebuffer (RFB) protocol to transmit framebuffers (whichcontain the values for every pixel to be displayed on a screen) from theremote desktop server to the client. In order to reduce the amount ofdisplay data relating to the graphical user interface that istransmitted to the thin client application, the remote desktop servermay retain a second copy of the framebuffer that reflects a prior stateof the framebuffer. This second copy enables the remote desktop serverto compare a prior state and current state of the framebuffer in orderto identify display data differences to encode (to reduce networktransmission bandwidth) and subsequently transmit onto the network tothe thin client application.

However, transmitting the display data differences onto the network tothe thin client application can deteriorate performance of both theremote desktop server and the thin client application due to thecomputing overhead needed to encode the display data differences at theremote desktop server and subsequently decode them at the thin clientapplication. As a general example, to continually transmit data from anentire framebuffer that supports a resolution of 1920×1200 and colordepth of 24 bits per pixel onto the network at a rate of 60 times persecond would require transmission of over 3.09 gigabits per second. Evenassuming that display data differences (rather than an entireframebuffer) can be identified and further compressed through encodingtechniques prior to transmission, significant network bandwidth maystill be required.

SUMMARY

One or more embodiments of the present invention provide methods, in aserver having a primary framebuffer for storing display data and adisplay encoder that uses a secondary framebuffer for transmittingdisplay data to a remote client terminal, for reducing an amount ofdisplay data to be transmitted to the remote client terminal. In onesuch method, a queue comprising a list of completed drawing primitivesis updated upon execution of drawing primitives into the primaryframebuffer. The display encoder requests a list of drawing primitivesthat corresponds to updated display data in the secondary framebufferand the requested list of drawing primitives is extracted from the queueand provided to the display encoder. Upon receipt of the requested listof drawing primitives, the display encoder is able to selectivelytransmit to the remote client terminal a drawing primitive in therequested list over updated display data in the secondary framebuffercorresponding to the drawing primitive depending upon a bandwidth usageassessment.

In one embodiment, each entry in the queue comprises a sequence numberand a drawing primitive and the received request includes a sequencenumber corresponding to a last drawing primitive to update display datain the secondary framebuffer. In such an embodiment, the extracting stepcomprises identifying each entry in the queue including a sequencenumber up to and including the sequence number of the request.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a block diagram of a remote desktop server, according toone embodiment of the invention.

FIG. 2 depicts a “blitmap” data structure, according to one embodimentof the invention.

FIG. 3 depicts a second blitmap data structure, according to oneembodiment of the invention.

FIG. 4 depicts a FIFO queue, according to one embodiment of theinvention.

FIG. 5 is a flow diagram depicting steps to transmit drawing requestsfrom an application to a video adapter, according to one embodiment ofthe invention.

FIG. 6 is a flow diagram depicting steps to transmit framebuffer datafrom a video adapter to a display encoder, according to one embodimentof the invention.

FIG. 7 depicts an example of trimming a blitmap data structure,according to one embodiment of the invention.

FIG. 8 illustrates one example of bandwidth savings by transmitting adrawing primitive to a remote client display rather than transmittingcorresponding display data changes made to the framebuffer.

FIG. 9 is a flow diagram depicting steps to transmit drawing primitivesfrom a video adapter driver to a display encoder, according to oneembodiment of the invention.

DETAILED DESCRIPTION

FIG. 1 depicts a block diagram of a remote desktop server according toone embodiment of the invention. Remote desktop server 100 may beconstructed on a desktop, laptop or server grade hardware platform 102such as an x86 architecture platform. Such a hardware platform mayinclude CPU 104, RAM 106, network adapter 108 (NIC 108), hard drive 110and other I/O devices such as, for example and without limitation, amouse and keyboard (not shown in FIG. 1).

A virtualization software layer, also referred to hereinafter ashypervisor 124, is installed on top of hardware platform 102. Hypervisor124 supports virtual machine execution space 126 within which multiplevirtual machines (VMs 128 ₁-128 _(N)) may be concurrently instantiatedand executed. In one embodiment, each VM 128 ₁-128 _(N) supports adifferent user who is remotely connected from a different clientterminal. For each of VMs 128 ₁-128 _(N), hypervisor 124 manages acorresponding virtual hardware platform (i.e., virtual hardwareplatforms 130 ₁-130 _(N)) that includes emulated hardware implemented insoftware such as CPU 132, RAM 134, hard drive 136, NIC 138 and videoadapter 140. Emulated video adapter 140 allocates and maintains aframebuffer 142, which is a portion of memory used by video adapter 140that holds a buffer of the pixel values from which a video display(i.e., “frame”) is refreshed, and a First In First Out (FIFO) queue 144,which is a portion of memory used by video adapter 140 that holds a listof drawing primitives that are used to update framebuffer 142. In oneembodiment, FIFO queue 144 is a shared memory buffer that is accessedand shared between video adapter 140 and video adapter driver 154.

Virtual hardware platform 130 ₁ may function as an equivalent of astandard x86 hardware architecture such that any x86 supported operatingsystem, e.g., Microsoft Windows®, Linux®, Solaris® x86, NetWare,FreeBSD, etc., may be installed as guest operating system (OS) 146 toexecute applications 148 for an instantiated virtual machine, e.g., VM128 ₁. Applications 148 that require drawing on a display submit drawingrequests through an API offered by graphical drawing interface layer 150(e.g., Microsoft Windows® GDI, in one embodiment) which, in turn,converts the drawing requests into drawing commands and transmits thedrawing commands to a video adapter driver 154 in device driver layer152. As shown in the embodiment of FIG. 1, video adapter driver 154allocates and maintains its own FIFO queue 157 to keep track of drawingprimitives as well as a data structure 156, referred to hereinafter as a“blitmap” data structure that keeps track of potentially changed regionsof framebuffer 142 of video adapter 140. Further details on theimplementation and usage of blitmap data structures are detailed laterin this Detailed Description. Device driver layer 152 includesadditional device drivers such as NIC driver 158 that interact withemulated devices in virtual hardware platform 130 ₁ (e.g., virtual NIC138, etc.) as if such emulated devices were the actual physical devicesof hardware platform 102. Hypervisor 124 is generally responsible fortaking requests from device drivers in device driver layer 152 that arereceived by emulated devices in virtual platform 130 ₁, and translatingthe requests into corresponding requests for real device drivers in aphysical device driver layer of hypervisor 124 that communicates withreal devices in hardware platform 102.

In order to transmit graphical user interfaces to the display of aremote client terminal, VM 128 ₁ further includes a display encoder 160that interacts with video adapter driver 154 (e.g., through an API) toobtain data from framebuffer 142 for encoding (e.g., to reduce networktransmission bandwidth) and subsequent transmission onto the networkthrough NIC driver 158 (e.g., through virtual NIC 138 and, ultimately,through physical NIC 108). Display encoder 160 allocates and maintains asecondary framebuffer 162 for storing data received from framebuffer142, its own blitmap data structure 164 (hereinafter, referred to asencoder blitmap data structure 164) for identifying changed regions insecondary framebuffer 162, and its own FIFO queue 166 for trackingdrawing primitives whose execution resulted in the changed regions insecondary framebuffer 162. In one embodiment, display encoder 160continuously polls video adapter driver 154 (e.g., 30 or 60 times asecond, for example) to copy changes made in framebuffer 142 tosecondary framebuffer 162 to transmit to the remote client terminal.

Those with ordinary skill in the art will recognize that the variousterms, layers and categorizations used to describe the virtualizationcomponents in FIG. 1 may be referred to differently without departingfrom their functionality or the spirit of the invention. For example,virtual hardware platforms 130 ₁-130 _(N) may be considered to be partof virtual machine monitors (VMM) 166 ₁-166 _(N) which implement thevirtual system support needed to coordinate operations betweenhypervisor 124 and corresponding VMs 128 ₁-128 _(N). Alternatively,virtual hardware platforms 130 ₁-130 _(N) may also be considered to beseparate from VMMs 166 ₁-166 _(N), and VMMs 166 ₁-166 _(N) may beconsidered to be separate from hypervisor 124. One example of hypervisor124 that may be used in an embodiment of the invention is included as acomponent of VMware's ESX™ product, which is commercially available fromVMware, Inc. of Palo Alto, Calif. It should further be recognized thatembodiments of the invention may be practiced in other virtualizedcomputer systems, such as hosted virtual machine systems, where thehypervisor is implemented on top of an operating system.

FIG. 2 depicts a blitmap data structure, according to one embodiment ofthe invention. Both video adapter driver 154 and display encoder 160utilize a blitmap data structure to track changed regions of framebuffer142 and secondary framebuffer 162, respectively. In the embodiment ofFIG. 2, the blitmap data structure is a 2 dimensional bit vector whereeach bit (also referred to herein as a “blitmap entry”) in the bitvector represents an N×N region of a corresponding framebuffer. A bitthat is set (also referred to herein as a “marked” blitmap entry) in thebit vector indicates that at least one pixel value in the correspondingN×N region of the framebuffer has been changed during a particularinterval of time (e.g., between polling requests by display encoder 160,for example). For example, FIG. 2 depicts a 64×64 pixel block 200 of aframebuffer where blackened dots represent pixel values that havechanged during a particular interval of time. An 8×8 bit vector 205represents a corresponding blitmap entry block of a blitmap datastructure where each bit (or blitmap entry) corresponds to an 8×8 regionin pixel block 200. A set bit (or marked blitmap entry) in bit vector205 is represented by an “X.” For example, marked blitmap entry 210corresponds to framebuffer region 215 (all of whose pixel values havechanged during a specified interval of time as indicated by the blackdots). FIG. 2 illustrates other marked blitmap entries in bit vector 205that correspond to regions in framebuffer pixel block 200 that havepixel values that have changed, as illustrated by blackened dots. Bytraversing a 2 dimensional bit vector embodiment of a blitmap datastructure similar to 205 of FIG. 2, one can readily identify which N×Nregions of a framebuffer have changed during a time interval (and alsoeasily skip those regions that have not changed during the timeinterval).

FIG. 3 depicts a second blitmap data structure, according to oneembodiment of the invention. In the embodiment of FIG. 3, the blitmapdata structure is a region quadtree where each level of the treerepresents a higher resolution bit vector of 2^(N)×2^(N) pixel blocks.FIG. 3 illustrates a 64×64 pixel block 300 of a framebuffer whereblackened dots represent pixel values that have changed during aparticular interval of time. A pixel block is successively subdividedinto smaller and smaller sub-quadrants until each changed pixel (e.g.,blackened dots) is contained within a smallest sub-quadrant. Forexample, in pixel block 300, the smallest sub-quadrant is an 8×8 pixelregion, such as regions 305, 310 and 315. Larger sub-quadrants include16×16 sub-quadrants, such as 320 and 325, as well as 32×32sub-quadrants, such as 330. A four-level region quadtree 335 representsa blitmap data structure that corresponds to 64×64 pixel block 300 ofthe framebuffer. As depicted in FIG. 3, each level of region quadtree335 can be implemented as a bit vector whose bits correspond to asub-quadrant of a particular size in pixel block 300, ranging from 64×64to 8×8, depending upon the level of the bit vector. A node in regionquadtree 335 that is marked with an “X” indicates that at least onepixel value in the node's corresponding sub-quadrant in pixel block 300has been changed during the particular interval of time (i.e., has ablackened dot). For example, node 300 _(Q) of level 0 (the 64×64 level)of region quadtree 335 represents the entirely of 64×64 pixel block andis marked with an “X” since at least one pixel value in pixel block 300has changed. In contrast, node 330 _(Q) of level 1 (the 32×32 level) ofregion quadtree 335 represents 32×32 sub-quadrant 330 and is unmarkedsince no pixel values in sub-quadrant 330 have changed. Similarly, nodes320 _(Q) and 325 _(Q) of level 2 (the 16×16 level) represent 16×16sub-quadrants 320 and 325, respectively, and are unmarked since no pixelvalues in sub-quadrants 320 and 325 have changed. Nodes 305 _(Q), 310_(Q) and 315 _(Q) of level 3 (the 8×8 level) correspond to 8×8 regions305, 310 and 315 of pixel block 300, respectively, and are markedaccordingly. In a region quadtree embodiment of a blitmap datastructure, such as the embodiment of FIG. 3, each node in the deepestlevel of the region quadtree (i.e., corresponding to the smallestsub-quadrant, such as an 8×8 pixel region) is a blitmap entry. Bytraversing a region quadtree embodiment of a blitmap data structure, onecan readily identify which 8×8 regions (or other smallest sizedsub-quadrant) of a framebuffer have changed during a time interval.Furthermore, due to its tree structure, one can also quickly skip largesized sub-quadrants in the framebuffer that have not changed during thetime interval. It should further be recognized that a region quadtreeembodiment of a blitmap data structure may further conserve memory usedby the blitmap data structure, depending upon the particularimplementation of the region quadtree. For example, while the 2dimensional bit vector embodiment of a blitmap data structure 205 ofFIG. 2, consumes 64 bits no matter how many 8×8 regions may be unmarked,region quadtree 335 of FIG. 3 consumes fewer bits when fewer 8×8 regionsare marked. As depicted, the implementation of blitmap data structure205 utilizes 64 bits while blitmap data structure 335 utilizes 33 bits.It should be recognized that encoder blitmap data structure 164 anddriver blitmap data structure 156 may each be implemented using avariety of different data structures, including those of FIGS. 2 and 3,and that in any particular embodiment, encoder blitmap data structure164 may use a different data structure than driver blitmap datastructure 156.

FIG. 4 depicts a FIFO queue, according to one embodiment of theinvention. Video adapter 140, video adapter driver 154, and displayencoder 160 each utilize a FIFO queue to keep track of drawingprimitives of framebuffer 142 (for video adapter 140 and video adapterdriver 154) and secondary framebuffer 162 (for display encoder 160).FIFO queue 400 of FIG. 4 is a circular buffer of size 100 where eachentry in FIFO queue 400 includes a sequence number 405 and a drawingprimitive 410. In one embodiment, examples of drawing primitives includebasic drawing instructions such as copy (e.g., rectangular area toanother rectangular area), fill (e.g., a rectangular area with a color),update (e.g., an existing rectangular area with new display data) andthe like. As an example, FIFO queue entry 415 has a sequence number of 8and a drawing primitive that instructs video adapter 140 to copy thecontents of a source rectangle in an area of framebuffer 142 to adestination rectangle in another area of framebuffer 142. Free entrypointer 420 points to the next entry in FIFO queue 400 to insert a newentry (i.e., queue entry 6) and is incremented every time a new entry isinserted into FIFO queue 400. Current entry pointer 425 points the nextentry in FIFO queue 400 that is to be executed by video adapter 140(i.e., queue entry 97) and is incremented every time video adapter 140completes execution of a drawing primitive. As shown in FIG. 4, queueentries 6 through 96 represent the set of queue entries whose drawingprimitives have been already executed by video adapter 140 (referred toas executed entries 430) and queue entries 1 through 5 and 97 through100 represent the set of queue entries than contain unexecuted drawingprimitives or otherwise empty entries (referred to as unexecuted entries435). It should be recognized that alternative embodiments of FIFOqueues may be used as any of FIFO queues 144, 157 and 166. For example,in one embodiment, FIFO queue 144 in video adapter 140 may not havesequence numbers. Similarly, in an alternative embodiment, each drawingprimitive stored in a FIFO queue consumes the same amount of bytes(e.g., 24 bytes, for example) such that sequence numbers can be derived(rather than stored as a filed of a queue entry) by determining anoffset from a starting point in the queue.

FIG. 5 is a flow diagram depicting steps to transmit drawing requestsfrom an application to a video adapter, according to one embodiment ofthe invention. Although the steps are described with reference to thecomponents of remote desktop server 100 in FIG. 1, it should berecognized that any system configured to perform the steps, in anyorder, is consistent with the present invention.

According to the embodiment of FIG. 5, in step 505, during itsexecution, application 500 (i.e., one of applications 148 running onguest OS 146) accesses the API of graphical drawing interface layer 150(e.g., GDI in Microsoft Windows) to submit drawing requests to a screen,for example, to update its graphical user interface in response to auser action. In step 510, through guest OS 146, graphical drawinginterface layer 150 receives the drawing requests and converts them intodrawing commands that are understood by video adapter driver 154. Instep 515, graphical drawing interface layer 150 transmits the drawingcommands to video adapter driver 154. In step 520, video adapter driver154 receives the drawing commands and marks entries of driver blitmapdata structure 156 to indicate that at least a portion of pixel valuesin regions of framebuffer 142 corresponding to the marked entries ofdriver blitmap data structure 156 will be updated as a result ofexecuting the drawing commands. In one embodiment, video adapter driver154 calculates or otherwise determines an area within framebuffer 142,such as a rectangle of minimum size that encompasses the pixels thatwill be updated as a result of executing the drawing commands (i.e.,also referred to herein as a “bounding box”). Video adapter driver 154is then able to identify and mark all blitmap entries in driver blitmapdata structure 156 corresponding to regions of framebuffer 154 thatinclude pixel values in the determined area. In step 525, video adapterdriver 154 converts the drawing commands to device specific drawingprimitives and, in step 530, inserts the device specific drawingprimitives into its FIFO queue 157, accordingly incrementing the freeentry pointer of FIFO queue 157. In step 535, video adapter driver 154then inserts the drawing primitives into FIFO queue 144 (e.g., in anembodiment where FIFO queue 144 is shared between video adapter driver154 and video adapter 140) and accordingly increments the free entrypointer of FIFO queue 144. In step 540, video adapter 140 updatesframebuffer 142 in accordance with the drawing primitives in FIFO queue144 when they are ready to be acted upon. Specifically, in step 545,once video adapter 140 completes executing a drawing primitive, itincrements the current entry pointer of its FIFO queue 144 and in step550 notifies video adapter driver 154 to increment the current entrypointer of FIFO queue 157, which video adapter driver 154 does in step555.

FIG. 6 is a flow diagram depicting steps to transmit framebuffer datafrom a video adapter to a display encoder, according to one embodimentof the invention. Although the steps are described with reference to thecomponents of remote desktop server 100 in FIG. 1, it should berecognized that any system configured to perform the steps, in anyorder, is consistent with the present invention.

According to the embodiment of FIG. 6, display encoder 160 is a processrunning on guest OS 146 which continually polls (e.g., 30 or 60 times asecond, for example) video adapter driver 154 to obtain data inframebuffer 154 of video adapter 140 to encode and transmit onto thenetwork (e.g., through NIC driver 158) for receipt by a remote clientterminal. In step 600, display encoder 160, via an API routine exposedto it by video adapter driver 154, issues a framebuffer update requestto video adapter driver 154 and passes to video adapter driver 154 amemory reference (e.g., pointer) to secondary framebuffer 162 to enablevideo adapter driver 154 to directly modify secondary framebuffer 162.In step 605, video adapter driver 154 receives the framebuffer updaterequest and, in step 610, it traverses driver blitmap data structure 156to identify marked blitmap entries that correspond to regions offramebuffer 142 that have changed since the previous framebuffer updaterequest from display encoder 160 (due to drawing requests fromapplications as described in FIG. 5). If, in step 615, a current blitmapentry is marked, then, in step 620, video adapter driver 154 requeststhe corresponding region (i.e., the pixel values in the region) offramebuffer 142 from video adapter 140. In step 625, video adapter 140receives the request and transmits the requested region of framebuffer142 to video adapter driver 154.

In step 630, video adapter driver 154 receives the requested region offramebuffer 142 and, in step 635, compares the pixel values in thereceived requested region of framebuffer 142 to the pixel values of thecorresponding region in secondary framebuffer 162, which reflects aprevious state of the framebuffer 142 upon completion of the response ofvideo adapter driver 154 to the previous framebuffer update request fromdisplay encoder 160. This comparison step 635 enables video adapterdriver 154 to identify possible inefficiencies resulting from visuallyredundant transmissions of drawing requests by applications as describedin FIG. 5. For example, perhaps due a lack of focus on optimizingdrawing related aspects of their functionality, some applications mayissue drawing requests in step 505 of FIG. 5 that redundantly redrawtheir entire graphical user interface even if only a small region of thegraphical user interface was actually modified by the application. Suchdrawing requests cause entries in driver blitmap data structure 156 tobe marked in step 520 of FIG. 5 even if the corresponding framebuffer142 regions of the marked blitmap entries need not be updated with newpixel values (i.e., the regions correspond to parts of the graphicaluser interface that are not actually modified). With such marked blitmapentries, comparison step 635 will reveal that the regions of framebuffer142 and secondary framebuffer 162 corresponding to the marked blitmapentries are the same since the pixel values of such regions did notchange due to visually redundant drawing requests submitted byapplications (in step 505) after completion of video adapter driver's154 response to the previous framebuffer update request from displayencoder 160.

As such, in step 640, if comparison step 635 indicates that the regionsof framebuffer 142 and secondary framebuffer 162 are the same, then instep 645, video adapter driver 154 “trims” driver blitmap data structure156 by clearing the marked blitmap entry to indicate that no actualpixel values were changed in the corresponding region of framebuffer 142since completion of video adapter driver's response to the previousframebuffer update request from display encoder 160. FIG. 7 depicts anexample of trimming a blitmap data structure, according to oneembodiment of the invention. FIG. 7 illustrates a 88×72 pixel block 700of framebuffer 142. Each subdivided block, such as 705, represents an8×8 pixel region that corresponds to a blitmap entry in driver blitmapdata structure 156. As depicted in FIG. 7, an application has issueddrawing requests pursuant to step 505 of FIG. 5 in order to draw asmiley face as depicted in pixel block 700. However, the drawingrequests issued by the application inefficiently request that theentirety of pixel block 700 gets redrawn, rather than just requestingthe drawing of the specific pixels of the smiley face itself. As such,each of the blitmap entries in a corresponding 11×9 blitmap block 710 ofdriver blitmap data structure 156 are marked by video adapter driver 154pursuant to step 420 of FIG. 5 (such as marked blitmap entry 715).However, when display encoder 160 issues a framebuffer update request tovideo adapter driver 154, as described herein in relation to FIG. 6,video adapter driver 154 is able to trim blitmap block 710, therebycreating blitmap block 720, by clearing blitmap entries, such asunmarked blitmap 725, whose corresponding regions in framebuffer 142were not actually changed (i.e., did not contain a smiley face modifiedpixel) pursuant to step 645 of FIG. 6.

Returning to FIG. 6, if, however, in step 640, the comparison step 635indicates that the regions of framebuffer 142 and secondary framebuffer162 are different (i.e., actual pixel values in the region offramebuffer 142 have changed as a result of drawing requests ofapplications in step 505 since completing the response to the previousframebuffer update request from display encoder 160), then in step 650,video adapter driver 154 copies the pixel values in the region offramebuffer 142 to the corresponding region of secondary framebuffer 162to properly reflect in secondary framebuffer 162 the changed pixelvalues in the region of framebuffer 142. In step 655, if video adapterdriver 154 has not completed traversing driver blitmap data structure156, the flow returns to step 610. If, in step 655, video adapter driver154 has completed traversing driver blitmap data structure 156, then instep 660, video adapter driver 154 provides a copy of driver blitmapdata structure 156 to display encoder 160, which becomes and is referredto herein as encoder blitmap data structure 164. To the extent thatmarked blitmap entries were cleared in driver blitmap data structure 156in step 645, encoder blitmap data structure 164 reflects a moreoptimized view of regions in secondary framebuffer 162 that have actualchanged pixel values. In step 665, video adapter driver 154 clears allthe marked blitmap entries in driver blitmap data structure 156 inpreparation for receiving a subsequent framebuffer update request fromdisplay encoder 160. In step 670, video adapter driver 154 provides todisplay encoder 160 the sequence number of the last drawing primitive inFIFO queue 157 to have been executed into framebuffer 142 upon issuanceof the framebuffer update request in step 600, indicating to displayencoder 160 that it has completed its response to the framebuffer updaterequest issued in step 600. In the FIFO queue embodiment of FIG. 4, forexample, the sequence number provided to display encoder 160 in step 670is 96, which represents the queue entry immediately before the queueentry pointed to by current entry pointer 425.

Upon completion of video adapter driver's 154 response to framebufferupdate request issued by display encoder 160 in step 600, secondaryframebuffer 162 contains all changed pixel values resulting from drawingrequests from applications (from step 505 of FIG. 5) since the completedresponse to the previous framebuffer update request from display encoder160 and encoder blitmap data structure 164 contains marked blitmapentries that indicate which regions within secondary framebuffer 162contain such changed pixel values.

With such information, in step 675, display encoder 160 can traverseencoder blitmap data structure 164 for marked blitmap entries andextract only those regions in secondary framebuffer 162 that correspondto such marked blitmap entries for encoding and transmission to a remoteclient display. However, in one embodiment, display encoder 160 canfurther reduce the amount of bandwidth required to transmit changes toframebuffer 142 to the remote client display by selectively transmittingdrawing primitives that describe changes made to framebuffer 142 ratherthan transmitting the actual corresponding display data changes that arereflected in secondary framebuffer 162. FIG. 8 illustrates one exampleof bandwidth savings by transmitting a drawing primitive to a remoteclient display rather than transmitting corresponding display datachanges made to the framebuffer. Block 800 represents an 88×72 pixelblock 800 of framebuffer 142. Each subdivided block, such as 805,represents an 8×8 pixel region that corresponds to a blitmap entry indriver blitmap data structure 156. As depicted in FIG. 8, video adapter140 is about to execute a “copy” drawing primitive 810 of a queue entryin FIFO queue 140 to copy an existing rectangle to another region ofpixel block 800 (i.e., similar to queue entry 415 of FIG. 4). Uponexecuting drawing primitive 810, pixel block 800 of framebuffer 142 istransformed into pixel block 815 (i.e., the rectangle has been copied tothe new region of the pixel block).

Similarly, in accordance with step 520 of FIG. 5, driver blitmap datastructure 156 is also updated as illustrated by blitmap data structureblock 820. While equation 825 reveals that transmitting the changeddisplay data in framebuffer 142 to a remote client terminal wouldinvolve transmitting about 3840 bytes in uncompressed format, equation830 reveals that transmitting the drawing primitive 810 itself wouldinvolve transmitting only about 24 bytes (i.e., wherein the remoteclient terminal would execute the received drawing primitive to obtainthe display data). Furthermore, while compression encoding techniquescan reduce the amount of display data transmitted, even an optimalcompression technique that reduces the size of the uncompressed formatby a factor of, for example, 100, would still require transmission 38.4bytes which remains larger than the 24 byte drawing primitive. Anotherbenefit is reduced CPU time. For example, while it may be possible touse display compression display data to a size as small or even smallerthan the corresponding display primitive, transmitting the displayprimitive requires significantly less CPU time then the necessarycompression algorithm.

FIG. 9 is a flow diagram depicting steps to transmit drawing primitivesfrom a video adapter driver to a display encoder, according to oneembodiment of the invention. Although the steps are described withreference to the components of remote desktop server 100 in FIG. 1, itshould be recognized that any system configured to perform the steps, inany order, is consistent with the present invention.

In step 900, display encoder 160 receives the sequence numbertransmitted by video adapter driver 154 upon completion of a framebufferupdate request in step 670 of FIG. 6. In step 905, display encoder 160then transmits the sequence number and a memory reference to FIFO queue166 to video adapter driver 154 in a request for a list of drawingprimitives relating to the updated display data contained in secondaryframebuffer 162 received in step 900. When video adapter driver 154receives the request in step 910, it determines, in step 915, thosequeue entries of its FIFO queue 157 that have sequence numbers up to(and including) the sequence number received in the request and copiesthose queue entries into FIFO queue 166 for access by display encoder160. For example, in one embodiment, FIFO queue 157 of video adapterdriver 154 is updated according to the steps of FIG. 5 (i.e., steps 530and 555) and is implemented in a manner similar to FIFO queue 400 ofFIG. 4 and video adapter driver 154 further stores a copy of a priorsequence number that was transmitted to display encoder 160 in step 670of FIG. 6 for the framebuffer update request immediately prior to thecurrent framebuffer update request that resulted in the issuance of thedrawing primitives list request of step 900 by display encoder 160. Thisprior sequence number represents the sequence number of the last drawingprimitive in FIFO queue 157 that was utilized to update framebuffer 142in the framebuffer update request immediately prior to the currentframebuffer update request. As such, those drawing primitives in queueentries of FIFO queue 157 having sequence numbers subsequent to thissequence number and up to (and including) the sequence number receivedin step 905 represent the display primitives that updated display datacopied to secondary framebuffer 162 in step 650 of FIG. 6. In such anembodiment, video adapter driver 154 copies the queue entries of thesedisplay primitives from its FIFO queue 157 to FIFO queue 166 in step920. In step 925, video adapter driver 154 then clears or otherwiseremoves these queue entries from its own FIFO queue 157 and notifiesdisplay encoder 160 that is has completed responding to the drawingprimitives list request from step 905.

It should be recognized that alternative embodiments may utilize adifferent implementation of FIFO queue 157 that is updated in mannerdifferent from the process of FIG. 5. For example, in one alternativeembodiment, drawing primitives are not inserted into FIFO queue 157 instep 530. Rather, only drawing primitives that have been completed byvideo adapter 140 in step 550 are inserted into FIFO queue 157.Specifically, step 550 is modified such that video adapter 140 transmitsthe completed drawing primitives to video adapter driver 154 which theninserts them into its FIFO queue 157. In such an embodiment, FIFO queue157 can be implemented as a simple vector buffer and does not need afree entry pointer 420 or current entry pointer 425. Specifically, allthe entries from the beginning of FIFO queue 157 up to the requestedsequence number are provided to display encoder 160 in step 910 and instep 915, the remaining entries are shifted to the beginning of FIFOqueue 157 after removal of the provided entries in step 925.

After step 925, display encoder 160 has access to updated display datain secondary framebuffer 162, an encoder blitmap data structure 164 thatindicates which regions of secondary framebuffer 162 include updateddisplay data, and a FIFO queue 166 that includes a list of drawingprimitives that effectuated the updated display data in secondaryframebuffer 162. As such, display encoder 160 is able to determine themore efficient method of propagating display data changes to a remoteclient terminal between transmitting the updated display data itself ortransmitting the data primitives effectuating the updated display data.For example, returning to the embodiment of FIG. 9, in step 930, displayencoder 160 reviews the list of drawing primitives in FIFO queue 166 toidentify isolated drawing primitives that draw into framebuffer regionsthat are not drawn into by other drawing primitives in FIFO queue 166.In step 935, if transmitting an identified drawing primitive is fasterthan transmitting the amount of display data affected by such drawingprimitive, then in step 940, display encoder 160 clears those blitmapentries in encoder blitmap data structure 164 corresponding to theregions of framebuffer 162 affected by the drawing primitive and, instep 945, transmits the drawing primitive to the remote client terminal.If, in step 935, display encoder 160 determines that it is moreefficient to transmit the display data rather than the identifieddrawing primitive, then in step 950, display encoder transmits thedisplay data in secondary framebuffer 162 (i.e., in accordance with themarked entries in encoder blitmap data structure 164). It should berecognized that various methods may be utilized by display encoder 160to determine in step 935 whether to transmit updated display data orcorresponding drawing primitives to the remote client terminalconsistent with the teachings herein. For example, in one embodiment,display encoder 160 compares the amount of display data affected by adrawing primitive identified in step 930 to the size of the drawingprimitive itself. In an alternative embodiment, certain displayprimitives (e.g., copy or fill drawing primitives, for example) areassumed to be more efficient to transmit that the affected display data.It should be recognized that any number of heuristics may be used todetermine whether to send the drawing primitive or the affected displaydata consistent with the teachings herein.

It should be recognized that various modifications and changes may bemade to the specific embodiments described herein without departing fromthe broader spirit and scope of the invention as set forth in theappended claims. For example, although FIG. 1 depicts an embodimentwhere display encoder 160 and video adapter driver 154 run in a virtualmachine 128 ₁ that communicates with a virtual video adapter 140 in ahypervisor 124, it should be recognized that embodiments of theinvention may be deployed in any remote desktop server architecture,including non-virtual machine based computing architectures.Furthermore, rather than having display encoder 160 and virtual videoadapter 140 as software components of the server, alternativeembodiments may utilize hardware components for each or either of them.Similarly, it should be recognized that alternative embodiments may notrequire any virtual video adapter. Instead, in such alternativeembodiments, for example, video adapter driver 154 may allocate andmanage framebuffer 142 and FIFO queue 144 itself. Similarly, it shouldbe recognized that FIFO queue 166 may not be required in alternativeembodiments. Instead, in such alternative embodiments, display encoder160 is able to directly access FIFO queue 157 of video adapter driver154, for example, through its own read pointers. It should be similarlyrecognized that various other data structures and buffers describedherein can be allocated and maintained by alternative system componentswithout departing from the spirit of the invention. For example, ratherthan having display encoder 160 allocate and maintain secondaryframebuffer 162 and pass a memory reference to video adapter driver 154as detailed in step 600 of FIG. 6, video adapter driver 154 may allocateand maintain secondary framebuffer 162 (as well as encoder blitmap datastructure 164) and provide memory reference access to display encoder160 in an alternative embodiment. Additionally, it should be recognizedthat some of the functionality and steps performed by video adapterdriver 154 as described herein can be implemented in a separateextension or component to a pre-existing or standard video adapterdriver (i.e., display encoder 160 may communicate with such a separateextension to the video adapter driver rather than the pre-existing videoadapter driver itself). Similarly, it should be recognized thatalternative embodiments may vary the amount and types of data exchangedbetween system components as described herein or utilize knownoptimization techniques without departing from the spirit of theinvention. For example, rather than having display encoder 160 transmita sequence number to video adapter driver 154 in step 905 of FIG. 9, analternative embodiment, in an alternative embodiment, video adapterdriver 154 internally keeps track of the previous drawing primitivesthat it has provided to display encoder in prior iterations of step 920such that it is able to provide the relevant drawing primitive todisplay encoder 160 without needing a sequence number. Additionally,rather than providing a copy of driver blitmap data structure 156 asencoder blitmap data structure 164 in step 660 of FIG. 6, an alternativeembodiment may provide only relevant portions of driver blitmap datastructure 156 to display encoder 160 or otherwise utilize an alternativedata structure to provide such relevant portions of driver blitmap datastructure 156 to display encoder 160. Similarly, an alternativeembodiment may not have a FIFO queue 157 in video adapter driver 154,but rather request FIFO queue entries from FIFO queue 144 through videoadapter 140. Similarly, rather than (or in addition to) having displayencoder 160 continuously poll video adapter driver 154, in alternativeembodiments, video adapter driver 154 can trigger an interrupt todisplay encoder 160 upon step 555 of FIG. 5 to notify display encoder160 of receipt of a drawing primitive that has updated framebuffer 142.In this manner, display encoder 160 need not issue continuous requeststo video adapter driver 154, for example, if the framebuffer 142 is notchanging.

The various embodiments described herein may employ variouscomputer-implemented operations involving data stored in computersystems. For example, these operations may require physical manipulationof physical quantities usually, though not necessarily, these quantitiesmay take the form of electrical or magnetic signals where they, orrepresentations of them, are capable of being stored, transferred,combined, compared, or otherwise manipulated. Further, suchmanipulations are often referred to in terms, such as producing,identifying, determining, or comparing. Any operations described hereinthat form part of one or more embodiments of the invention may be usefulmachine operations. In addition, one or more embodiments of theinvention also relate to a device or an apparatus for performing theseoperations. The apparatus may be specially constructed for specificrequired purposes, or it may be a general purpose computer selectivelyactivated or configured by a computer program stored in the computer. Inparticular, various general purpose machines may be used with computerprograms written in accordance with the teachings herein, or it may bemore convenient to construct a more specialized apparatus to perform therequired operations.

The various embodiments described herein may be practiced with othercomputer system configurations including hand-held devices,microprocessor systems, microprocessor-based or programmable consumerelectronics, minicomputers, mainframe computers, and the like.

One or more embodiments of the present invention may be implemented asone or more computer programs or as one or more computer program modulesembodied in one or more computer readable media. The term computerreadable medium refers to any data storage device that can store datawhich can thereafter be input to a computer system computer readablemedia may be based on any existing or subsequently developed technologyfor embodying computer programs in a manner that enables them to be readby a computer. Examples of a computer readable medium include a harddrive, network attached storage (NAS), read-only memory, random-accessmemory (e.g., a flash memory device), a CD (Compact Discs) CD-ROM, aCD-R, or a CD-RW, a DVD (Digital Versatile Disc), a magnetic tape, andother optical and non-optical data storage devices. The computerreadable medium can also be distributed over a network coupled computersystem so that the computer readable code is stored and executed in adistributed fashion.

Although one or more embodiments of the present invention have beendescribed in some detail for clarity of understanding, it will beapparent that certain changes and modifications may be made within thescope of the claims. Accordingly, the described embodiments are to beconsidered as illustrative and not restrictive, and the scope of theclaims is not to be limited to details given herein, but may be modifiedwithin the scope and equivalents of the claims. In the claims, elementsand/or steps do not imply any particular order of operation, unlessexplicitly stated in the claims.

In addition, while described virtualization methods have generallyassumed that virtual machines present interfaces consistent with aparticular hardware system, persons of ordinary skill in the art willrecognize that the methods described may be used in conjunction withvirtualizations that do not correspond directly to any particularhardware system. Virtualization systems in accordance with the variousembodiments, implemented as hosted embodiments, non-hosted embodiments,or as embodiments that tend to blur distinctions between the two, areall envisioned. Furthermore, various virtualization operations may bewholly or partially implemented in hardware. For example, a hardwareimplementation may employ a look-up table for modification of storageaccess requests to secure non-disk data.

Many variations, modifications, additions, and improvements arepossible, regardless of the degree of virtualization. The virtualizationsoftware can therefore include components of a host, console, or guestoperating system that performs virtualization functions. Pluralinstances may be provided for components, operations or structuresdescribed herein as a single instance. Finally, boundaries betweenvarious components, operations and data stores are somewhat arbitrary,and particular operations are illustrated in the context of specificillustrative configurations. Other allocations of functionality areenvisioned and may fall within the scope of the invention(s). Ingeneral, structures and functionality presented as separate componentsin exemplary configurations may be implemented as a combined structureor component. Similarly, structures and functionality presented as asingle component may be implemented as separate components. These andother variations, modifications, additions, and improvements may fallwithin the scope of the appended claims(s).

We claim:
 1. A system comprising: one or more computers having a primaryframebuffer and a display encoder that uses a second framebuffer totransmit display data, wherein the one or more computers are configuredto: update a queue of completed drawing primitives upon execution ofdrawing primitives into the primary framebuffer; receive a request fromthe display encoder for a list of drawing primitives that corresponds toupdated display data in the secondary framebuffer; provide the requestedlist of drawing primitives to the display encoder; determine a firstbandwidth usage for transmitting a drawing primitive from the requestedlist; determine a second bandwidth usage for transmitting the updateddisplay data corresponding to the drawing primitive from the secondaryframebuffer; and transmit either the drawing primitive or the updateddisplay data in the secondary framebuffer to a client terminal based onwhich of the first bandwidth usage and the second bandwidth usage islesser.
 2. The system of claim 1, wherein the one or more computers areconfigured to remove the requested list of drawing primitives from thequeue.
 3. The system of claim 1, wherein the request from the displayencoder includes a sequence number corresponding to a last drawingprimitive to update display data in the secondary framebuffer.
 4. Thesystem of claim 1, wherein providing the requested list of drawingprimitives comprises extracting the requested list of drawing primitivesfrom the queue, wherein extracting includes identifying each entry inthe queue including a sequence number up to and including the sequencenumber of the request.
 5. The system of claim 1, wherein the one or morecomputers further include: a video adapter driver for maintaining aqueue of drawing primitives, wherein each entry of the queue comprises asequence number and a drawing primitive.
 6. The system of claim 5,wherein the primary framebuffer is a buffer allocated by a virtual videoadapter and the queue is allocated by the video adapter driver thatcommunicates with the virtual video adapter.
 7. The system of claim 5,wherein the video adapter driver is a component of a guest operatingsystem of a virtual machine instantiated on the one or more computers.8. A method comprising: updating a queue of completed drawing primitivesupon execution of drawing primitives into a primary framebuffer;receiving a request for a list of drawing primitives that corresponds toupdated display data in a secondary framebuffer; providing the requestedlist of drawing primitives to a display encoder; determining a firstbandwidth usage for transmitting a drawing primitive from the requestedlist; determining a second bandwidth usage for transmitting the updateddisplay data corresponding to the drawing primitive from the secondaryframebuffer; and transmitting either the drawing primitive or theupdated display data in the secondary framebuffer to a client terminalbased on which of the first bandwidth usage and the second bandwidthusage is lesser.
 9. The method of claim 8, comprising clearing eachentry in the requested list of drawing primitives from the queue. 10.The method of claim 8, wherein the request includes a sequence numbercorresponding to a last drawing primitive to update display data in thesecondary framebuffer.
 11. The method of claim 10, wherein each entry inthe queue comprises a sequence number and a drawing primitive.
 12. Themethod of claim 11, wherein providing the requested list of drawingprimitives comprises extracting the requested list of drawing primitivesfrom the queue, wherein extracting includes identifying each entry inthe queue including a sequence number up to and including the sequencenumber of the request.
 13. The method of claim 8, wherein the primaryframebuffer is a buffer allocated by a virtual video adapter and thequeue is allocated by a video adapter driver that communicates with thevirtual video adapter.
 14. The method of claim 13, wherein the videoadapter driver is a component of a guest operating system of a virtualmachine instantiated on the server.
 15. The method of claim 8, furthercomprising the step of initiating an interrupt to the display encoderupon an update of the queue.
 16. A non-transitory computer-readablemedium including instructions that, when executed by a processing unitof a computer having a primary framebuffer for storing display data anda display encoder that uses a secondary framebuffer for transmittingdisplay data to a remote client terminal, causes the processing unit toperforming the steps of: updating a queue of completed drawingprimitives upon execution of drawing primitives into the primaryframebuffer; receiving a request from the display encoder for a list ofdrawing primitives that corresponds to updated display data in thesecondary framebuffer; providing the requested list of drawingprimitives to the display encoder; determining a first bandwidth usagefor transmitting a drawing primitive from the requested list;determining a second bandwidth usage for transmitting the updateddisplay data corresponding to the drawing primitive from the secondaryframebuffer; and transmitting either the drawing primitive or theupdated display data in the secondary framebuffer to the client terminalbased on which of the first bandwidth usage and the second bandwidthusage is lesser.
 17. The computer-readable medium of claim 16, furtherincluding instructions that cause the processing unit to performoperations comprising clearing each entry in the requested list ofdrawing primitives from the queue.
 18. The computer-readable medium ofclaim 16, wherein the request includes a sequence number correspondingto a last drawing primitive to update display data in the secondaryframebuffer.
 19. The computer-readable medium of claim 18, wherein eachentry in the queue comprises a sequence number and a drawing primitive.20. The computer-readable medium of claim 19, wherein providing therequested list of drawing primitives comprises extracting the requestedlist of drawing primitives from the queue, wherein extracting includesidentifying each entry in the queue including a sequence number up toand including the sequence number of the request.